Skip to content

Make Dataset a Context Manager.#68

Merged
dchansen merged 1 commit into
ismrmrd:masterfrom
fzimmermann89:dataset-contextmanager
Oct 6, 2023
Merged

Make Dataset a Context Manager.#68
dchansen merged 1 commit into
ismrmrd:masterfrom
fzimmermann89:dataset-contextmanager

Conversation

@fzimmermann89
Copy link
Copy Markdown
Contributor

@fzimmermann89 fzimmermann89 commented Jul 21, 2023

We would like to be able to use the Dataset class in a with statement, i.e.

with Dataset(...) as ds:
   dowork

instead of

ds=Dataset()
dowork
ds.close() # we tend to forget this line..

This is a simple 4 line change to enable this, similar to how it is done for the File class

Dataset can now be used in a with statement.
@fzimmermann89
Copy link
Copy Markdown
Contributor Author

Any opinions on this?

Best regards from Berlin,
Felix

@dchansen dchansen merged commit 41deff1 into ismrmrd:master Oct 6, 2023
@dchansen
Copy link
Copy Markdown
Contributor

dchansen commented Oct 6, 2023

Sorry for not catching this earlier. It's a good addition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants